<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">广告投放平台</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="复制" icon="fa fa-copy"
                                         actionListener="#{advertiseInfoBean.onCopy()}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{advertiseInfoBean.isView()}"/>
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{advertiseInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{advertiseInfoBean.isView() and security:areAllGranted('ADVERTISE_EDIT')}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{advertiseInfoBean.onSave}"
                                         rendered="#{advertiseInfoBean.isNotView() and security:areAnyGranted('ADVERTISE_EDIT,ADVERTISE_ADD')}"
                                         update="@form"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{advertiseInfoBean.changeStatusToView}"
                                         rendered="#{advertiseInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"></p:button>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>广告投放信息</h1>
                            <p:panelGrid columns="4"
                                         columnClasses="ui-grid-col-2,ui-grid-col-2"
                                         layout="grid" styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                <p:outputLabel for="accountId" value="账户id"/>
                                <p:inputText id="accountId" value="#{advertiseInfoBean.$.accountId}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="accountpwd" value="账户密码"/>
                                <p:inputText id="accountpwd" value="#{advertiseInfoBean.$.accountpwd}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="channel" value="渠道"/>
                                <p:inputText id="channel" value="#{advertiseInfoBean.$.channel}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="accessToken" value="上报回调凭证"/>
                                <p:inputText id="accessToken" value="#{advertiseInfoBean.$.accessToken}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="refreshToken" value="上报刷新凭证"/>
                                <p:inputText id="refreshToken" value="#{advertiseInfoBean.$.refreshToken}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="appId" value="开发者id"/>
                                <p:inputText id="appId" value="#{advertiseInfoBean.$.appId}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="appSecret" value="开发者密码"/>
                                <p:inputText id="appSecret" value="#{advertiseInfoBean.$.appSecret}"
                                             disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="userActionSetId" value="唯一数据源id"/>
                                <p:inputTextarea id="userActionSetId" value="#{advertiseInfoBean.$.userActionSetId}"
                                                 disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="actionType" value="上报类型参数"/>
                                <p:inputTextarea id="actionType" value="#{advertiseInfoBean.$.actionType}"
                                                 disabled="#{advertiseInfoBean.isView()}"/>

                                <p:outputLabel for="actionType" value="广告上报平台"/>
                                <p:selectOneMenu id="adsPlatformType" value="#{advertiseInfoBean.$.adsPlatformType}"
                                                 disabled="#{advertiseInfoBean.isView()}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{advertiseInfoBean.dictionaries[DictionaryCode.ADS_PLATFORM_TYPE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="eventType" value="回传行为类型"/>
                                <p:inputTextarea id="eventType" value="#{advertiseInfoBean.$.eventType}"
                                                 disabled="#{advertiseInfoBean.isView()}"/>

                            </p:panelGrid>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>